<template>
	<view class="" >
		<view v-if="item.kind === '0'" class="bg-white p-2 border-bottom" >
			<view class="font-30 text-main font-weight-bold" @click.stop="click">{{item.title}}</view>
			<view class="mt-2 font-sm text-light6" @click.stop="click">{{item.intro}}</view>
			<view class="mt-2 flex align-center" @click="like">
			   <u-icon :name="item.ulike===1?'thumb-up-fill':'thumb-up'" :color="item.ulike===1?'#02BC6B':''"></u-icon>
			   <view class="ml-1 font-sm text-light6">{{item.likes}}</view>
			</view>
		</view>
		<view v-if="item.kind === '1'" class="bg-white p-2 border-bottom flex align-center">
			<view class="flex flex-column" style="width: 500rpx;">
				<view class="font-30 text-main font-weight-bold" @click.stop="click">{{item.title}}</view>
				<view class="mt-2 font-sm text-light6" @click.stop="click">{{item.intro}}</view>
				<view class="mt-2 flex align-center" @click="like">
				   <u-icon :name="item.ulike===1?'thumb-up-fill':'thumb-up'" :color="item.ulike===1?'#02BC6B':''"></u-icon>
				   <view class="ml-1 font-sm text-light6">{{item.likes}}</view>
				</view>
			</view>
			<view class="ml-1" @click.stop="click">
				<u-image :src="item.url_images" width="184rpx" height="184rpx" radius="10"></u-image>
			</view>	
		</view>
		<view v-if="item.kind==='2'" class="bg-white p-2 border-bottom">
			<view class="font-30 text-main font-weight-bold" @click.stop="click">{{item.title}}</view>
			<view class="mt-2">
				<video :src="item.url_images" :poster="item.cover"  controls style="width: 710rpx;height: 282rpx;"></video>
			</view>
			<view class="mt-2 font-sm text-light6" @click.stop="click">{{item.intro}}</view>
			<view class="mt-2 flex align-center" @click="like">
			   <u-icon :name="item.ulike===1?'thumb-up-fill':'thumb-up'" :color="item.ulike===1?'#02BC6B':''"></u-icon>
			   <view class="ml-1 font-sm text-light6">{{item.likes}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		props:{
			item:Object,
			navtype:{
				type:String,
				default:'detail'
			}
		},
		
		methods:{
			click(){
				if(this.navtype==='detail') return
				uni.$u.route('pages/news/detail',{id:this.item.id})
			},
			like(){
				this.$api.newsLike({news_id:this.item.id}).then(res=>{
					if(res.code === 1){
						this.$emit('refresh')
					}
				})
			}
		}
	}
</script>

<style>
</style>